<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
request.setAttribute("basePath", basePath);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>山东省立医院</title>
<link rel="stylesheet" href="${basePath}/static/css/list.css"/>
<link rel="stylesheet" href="${basePath}/static/css/login.css"/>
<link rel="stylesheet" href="${basePath}/static/publics/assets/bootstrap/css/bootstrap.css"/>
<script type="text/javascript" src="${basePath}/static/publics/assets/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/static/js/header.js"></script>
<link href="${basePath}/static/css/Common/basic.css" rel="stylesheet" type="text/css">
<style>
	body{
         background:url(${basePath}/static/images/managerLogin-background.png) no-repeat; 
      }
	#box{width:1200px;margin:200px auto 0;}
	</style>
</head>
<body>

<!--<div id="div_login" style="display:none;">-->
<div id="box">
<div id="div_login"">

 <div class="login">
  <ul>
  	<form action="${basePath}/user/userLogin" method="post" id="form1">
  	
  						<li>
							<p style="width: 75px; float: left;">组织机构：</p>
						<p style="float: left; width: 100px;">
						<select name="orgCode" style="width: 220px;height: 28px;background: #fff;border: #cccccc solid 1px;border-radius: 6px;">
							<option value="49557184-0">山东省立医院</option>
						</select>
						
						</li>
  	
  						<li>
							<p style="width: 75px; float: left;">用&nbsp;户&nbsp;名：</p>
						<p style="float: left; width: 100px;">
						<INPUT style="float: none;" name="loginName"  id="loginName" type="text" class="textbox" value="${loginName}">
						</p>
						</li>
						
						<li>
							<p style="width: 75px; float: left;">密&nbsp;&nbsp;&nbsp;&nbsp; 码：</p>
							<p style="float: left; width: 100px;">
								<INPUT style="float: none;" name="password"
								id="txtPwd" type="password" class="textbox" value="${password }">
							</p>
						</li>
  					<!-- 	<li><span onclick="createCode()" style="letter-spacing:5px" id="checkCode"></span>验证码：&nbsp;&nbsp;<INPUT name="txtName" id="txtName" type="text" class="check" value=""></li> -->
 	 
 	 <!-- 
 	 <li>机&nbsp;&nbsp;&nbsp;构:<select name="orgCode" class="textbox"><option selected="selected" value="49557184-0">山东省立医院</option></select></li> 
 	  -->
  	 <li><a><INPUT name="btnLogin" class="L_up" id="btn_login" onclick="login()"
								type="button" value="登&nbsp;&nbsp;录"></a> <a><INPUT
								name="btnLogin" class="L_up2" id="closeBtn" type="button"
								value="重&nbsp;&nbsp;置"></a></li>
								
								<li style="text-align:center;color:red" id="errorMsg">${errorMsg}</li> 
   </form>
 </ul>
 </div>

</div>
</div>
</body>
<script type="text/javascript">
/* $(function() {
	var errorMsg = $("#errorMsg").text();
	if(errorMsg != null && errorMsg != '') {
		alert(errorMsg);
	}
});
 */
 $("#closeBtn").on('click',function(){
		$("#loginName").val("");
		$("#txtPwd").val("");
		$("#txtName").val("");
		createCode();
	});
$(function(){
	createCode();
});

	 var code; //在全局 定义验证码    
    function createCode() {  
        code = "";  
        var codeLength = 4;//验证码的长度       
  
        var selectChar = new Array(2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D',  
                'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',  
                'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');  
  
        for (var i = 0; i < codeLength; i++) {  
            var charIndex = Math.floor(Math.random() * 32);  
            code += selectChar[charIndex];  
        }  
        if (code.length != codeLength) {  
            createCode();  
        }  
        $("#checkCode").html(code);  
    }  
  
  /*   function validate() {  
        var inputCode = document.getElementById('txtName').value.toUpperCase();
        if (inputCode.length <= 0) {  
            alert("请输入验证码！");  
            return false;  
        } else if (inputCode != code) {  
            alert("验证码输入错误！");  
            createCode();  
            return false;  
        } else {  
            return true;  
        }  
  
    }   */
    
    
    function login(){
    	var userName= $("#loginName").val();
    	var password=$("#txtPwd").val();
    	if(!userName){
    		$("#errorMsg").html("用户名不能为空!");
    		return;
    	}
    	if(!password){
    		$("#errorMsg").html("密码不能为空!");
    		return;
    	}
    	
    	$("#form1").submit();
    	
    }
</script>
</html>
